import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeliveryVO, DeliveryForm, DeliveryQuery } from '@/api/system/delivery/types';

/**
 * 查询物流公司列表
 * @param query
 * @returns {*}
 */

export const listDelivery = (query?: DeliveryQuery): AxiosPromise<DeliveryVO[]> => {
  return request({
    url: '/system/delivery/list',
    method: 'get',
    params: query
  });
};
export const allList = (query?: DeliveryQuery): AxiosPromise<DeliveryVO[]> => {
  return request({
    url: '/system/delivery/allList',
    method: 'get'
    // params: query
  });
};
/**
 * 查询物流公司详细
 * @param dvyId
 */
export const getDelivery = (dvyId: string | number): AxiosPromise<DeliveryVO> => {
  return request({
    url: '/system/delivery/' + dvyId,
    method: 'get'
  });
};

/**
 * 新增物流公司
 * @param data
 */
export const addDelivery = (data: DeliveryForm) => {
  return request({
    url: '/system/delivery',
    method: 'post',
    data: data
  });
};

/**
 * 修改物流公司
 * @param data
 */
export const updateDelivery = (data: DeliveryForm) => {
  return request({
    url: '/system/delivery',
    method: 'put',
    data: data
  });
};

/**
 * 删除物流公司
 * @param dvyId
 */
export const delDelivery = (dvyId: string | number | Array<string | number>) => {
  return request({
    url: '/system/delivery/' + dvyId,
    method: 'delete'
  });
};
